package com.example.bloguser.controller;

import com.example.bloguser.util.QRCodeUtil;
import com.xpd.blog.bean.Userinfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.OutputStream;

@RestController
public class QrcodeDo {
    @Autowired
    RedisTemplate redisTemplate;
    public static final String MY_HEAD = "D:/er/c.jpg";
    @RequestMapping(path = "image", produces = MediaType.IMAGE_JPEG_VALUE)
    public void image(String content, OutputStream out) throws Exception {
        QRCodeUtil.encode(content, MY_HEAD, out, true);
    }

    @RequestMapping(path = "mobile", produces = MediaType.IMAGE_JPEG_VALUE)
    public void toMobile(OutputStream out) throws Exception {
        image("http://192.168.15.254/phone/phone.html", out);
    }

}
@Data
@AllArgsConstructor
@NoArgsConstructor
class ScanLoginInfo implements java.io.Serializable{
    String uuid;
    String status = "未扫描";
    Userinfo myinfo;
}

